/*
 * 
 */
package com.china08.yxyapi.repository.mg.moments;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.transaction.annotation.Transactional;

import com.china08.yxyapi.entity.mg.moments.YxyMoments;

/**
 * 学校班级圈,每发送一条班级圈,存储一条记录,图片存储成list的结构
 * 
 * @author Richard.Wang
 */
@Transactional
public interface YxyMomentsRepository extends MongoRepository<YxyMoments, String> {

    Page<YxyMoments> findByClassIdInOrderByCreatedDateDesc(List<String> classIdLst, Pageable pageable);

    Page<YxyMoments> findBySenderIdAndClassIdInOrderByCreatedDateDesc(String currentUserId, List<String> classIdLst,
            Pageable pageable);

    YxyMoments findById(String id);

    Page<YxyMoments> findByClassIdIn(List<String> classId, Pageable pageable);

    void deleteByIdAndSenderId(String id, String userId);

    Page<YxyMoments> findBySchoolIdAndStatus(String schoolId, Integer status, Pageable pageable);

    Page<YxyMoments> findBySenderIdOrderByCreatedDateDesc(String senderid, Pageable pageable);

    Page<YxyMoments> findByClassIdOrderByCreatedDateDesc(String classId, Pageable pageable);

    Page<YxyMoments> findByClassIdAndSenderIdOrderByCreatedDateDesc(String classId, String currentUserId,
            Pageable pageable);

    Page<YxyMoments> findBySchoolIdAndClassIdInAndStatusOrderByCreatedDateDesc(String schoolId, List<String> classIdLst,
            int i, Pageable pageable);

    Page<YxyMoments> findBySchoolIdAndClassIdAndStatusOrderByCreatedDateDesc(String schoolId, String classId, int i,
            Pageable pageable);

    Page<YxyMoments> findBySchoolIdAndClassIdAndSenderIdAndStatusOrderByCreatedDateDesc(String schoolId, String classId,
            String currentUserId, int i, Pageable pageable);

    Page<YxyMoments> findBySchoolIdAndClassIdInAndSenderIdAndStatusOrderByCreatedDateDesc(String schoolId,
            List<String> classIdLst, String currentUserId, int i, Pageable pageable);

}
